package demo;
class Price implements Cloneable{
    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
public class Dog implements Cloneable{
    public String name;
    public int age;

    Price price = new Price();
    @Override
    protected Object clone() throws CloneNotSupportedException {
        Dog dog = (Dog)super.clone();
        dog.price = (Price) this.price.clone();
        return dog;
    }

    public Dog(String name, int age) {
        this.name = name;
        this.age = age;
    }
}
